﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EventManageControl.ascx.cs" Inherits="UCWebpart.Admin.EventManageControl" %>
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="bookingID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" OnRowDeleting="GridView1_RowDeleting" OnRowDataBound="GridView1_RowDataBound">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:CommandField ShowDeleteButton="True" />
        <asp:BoundField DataField="bookingID" HeaderText="bookingID" ReadOnly="True" SortExpression="bookingID" Visible="False" />
        <asp:BoundField DataField="Column1" HeaderText="名称" ReadOnly="True" SortExpression="Column1" />
        <asp:BoundField DataField="bookingType" HeaderText="类型" SortExpression="bookingType" />
        <asp:BoundField DataField="bookingPerson" HeaderText="申请人" SortExpression="bookingPerson" />
        <asp:BoundField DataField="participants" HeaderText="participants" SortExpression="participants" Visible="False" />
        <asp:BoundField DataField="bookingTime" HeaderText="申请时间" SortExpression="bookingTime" />
        <asp:BoundField DataField="meetingTheme" HeaderText="活动主题" SortExpression="meetingTheme" />
        <asp:BoundField DataField="bookingState" HeaderText="状态" SortExpression="bookingState" />
        <asp:BoundField DataField="useResult" HeaderText="useResult" SortExpression="useResult" />
        <asp:BoundField DataField="meetingStartDate" HeaderText="开始日期" SortExpression="meetingStartDate" />
        <asp:BoundField DataField="startTime" HeaderText="时间" SortExpression="startTime" />
        <asp:BoundField DataField="meetingEndDate" HeaderText="结束日期" SortExpression="meetingEndDate" />
        <asp:BoundField DataField="endTime" HeaderText="时间" SortExpression="endTime" />
        <asp:CheckBoxField DataField="Monday" HeaderText="一" SortExpression="Monday" />
        <asp:CheckBoxField DataField="Tuesday" HeaderText="二" SortExpression="Tuesday" />
        <asp:CheckBoxField DataField="Wednesday" HeaderText="三" SortExpression="Wednesday" />
        <asp:CheckBoxField DataField="Thursday" HeaderText="四" SortExpression="Thursday" />
        <asp:CheckBoxField DataField="Friday" HeaderText="五" SortExpression="Friday" />
        <asp:CheckBoxField DataField="Saturday" HeaderText="六" SortExpression="Saturday" />
        <asp:CheckBoxField DataField="Sunday" HeaderText="日" SortExpression="Sunday" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:meetingroomManagementConnectionString %>"
     DeleteCommand="update [VenueBooking].[dbo].[MTR_bas_BookingManage]  set bookingState = '4',cancelPerson = @adminName ,cancelTime=GETDATE(),useResult=3,cancelReason='管理员取消'
where  [bookingID] = @bookingID
" InsertCommand="INSERT INTO [MTR_bas_BookingManage] ([bookingID], [bookingType], [Meetingroom], [bookingPerson], [bookingTime], [meetingTheme], [participants], [meetingAbstract], [specialRequestFirst], [specialRequestSecond], [bookingState], [cancelPerson], [cancelTime], [cancelReason], [useResult], [undefine1], [undefine2], [undefine3]) VALUES (@bookingID, @bookingType, @Meetingroom, @bookingPerson, @bookingTime, @meetingTheme, @participants, @meetingAbstract, @specialRequestFirst, @specialRequestSecond, @bookingState, @cancelPerson, @cancelTime, @cancelReason, @useResult, @undefine1, @undefine2, @undefine3)"
  SelectCommand="select bm.bookingID, bm.bookingType,bm.bookingPerson,bm.participants,bm.bookingTime,bm.meetingTheme,bm.bookingState,bm.useResult
,bs.meetingStartDate,
bs.startTime,bs.meetingEndDate,bs.endTime ,bs.Monday,bs.Tuesday,bs.Wednesday,bs.Thursday,bs.Friday,bs.Saturday,bs.Sunday,(
select m.mtrName from [VenueBooking].[dbo].[MTR_bas_Meetingroom] m where m.mtrId = bm.Meetingroom) 
from [VenueBooking].[dbo].[MTR_bas_BookingManage] bm ,[VenueBooking].[dbo].[MTR_bas_BookingSchedul] bs
where bs.planId = bm.bookingID and bs.meetingEndDate &gt;= (select CONVERT(varchar(10), getdate(), 120))  and bm.bookingState in (1,2,3) 
and bm.Meetingroom 
in
(SELECT MTR_bas_Meetingroom.mtrId FROM MTR_bas_Meetingroom (nolock) where mtrDelete=1 and 
        3 in (select distinct adminLevel from MTR_bas_Admin(nolock) where adminName=@adminName and Available=1)
        union
        select MTR_bas_Meetingroom.mtrId from MTR_bas_Admin with(nolock) join MTR_bas_Meetingroom with(nolock) 
        on MTR_bas_Admin.[VenueType]=MTR_bas_Meetingroom.[type]
        where adminName=@adminName and MTR_bas_Admin.Available='1' and MTR_bas_Meetingroom.mtrDelete='1')" 
    UpdateCommand="UPDATE [MTR_bas_BookingManage] SET [bookingType] = @bookingType, [Meetingroom] = @Meetingroom, [bookingPerson] = @bookingPerson, [bookingTime] = @bookingTime, [meetingTheme] = @meetingTheme, [participants] = @participants, [meetingAbstract] = @meetingAbstract, [specialRequestFirst] = @specialRequestFirst, [specialRequestSecond] = @specialRequestSecond, [bookingState] = @bookingState, [cancelPerson] = @cancelPerson, [cancelTime] = @cancelTime, [cancelReason] = @cancelReason, [useResult] = @useResult, [undefine1] = @undefine1, [undefine2] = @undefine2, [undefine3] = @undefine3 WHERE [bookingID] = @bookingID">
    <DeleteParameters>
        <asp:Parameter Name="adminName" />
        <asp:Parameter Name="bookingID" Type="String" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="bookingID" Type="String" />
        <asp:Parameter Name="bookingType" Type="String" />
        <asp:Parameter Name="Meetingroom" Type="Int32" />
        <asp:Parameter Name="bookingPerson" Type="String" />
        <asp:Parameter Name="bookingTime" Type="DateTime" />
        <asp:Parameter Name="meetingTheme" Type="String" />
        <asp:Parameter Name="participants" Type="String" />
        <asp:Parameter Name="meetingAbstract" Type="String" />
        <asp:Parameter Name="specialRequestFirst" Type="String" />
        <asp:Parameter Name="specialRequestSecond" Type="String" />
        <asp:Parameter Name="bookingState" Type="Int32" />
        <asp:Parameter Name="cancelPerson" Type="String" />
        <asp:Parameter Name="cancelTime" Type="DateTime" />
        <asp:Parameter Name="cancelReason" Type="String" />
        <asp:Parameter Name="useResult" Type="Int32" />
        <asp:Parameter Name="undefine1" Type="String" />
        <asp:Parameter Name="undefine2" Type="String" />
        <asp:Parameter Name="undefine3" Type="String" />
    </InsertParameters>
    <SelectParameters>
        <asp:SessionParameter Name="adminName" SessionField="userName" />
    </SelectParameters>
    <UpdateParameters>
        <asp:Parameter Name="bookingType" Type="String" />
        <asp:Parameter Name="Meetingroom" Type="Int32" />
        <asp:Parameter Name="bookingPerson" Type="String" />
        <asp:Parameter Name="bookingTime" Type="DateTime" />
        <asp:Parameter Name="meetingTheme" Type="String" />
        <asp:Parameter Name="participants" Type="String" />
        <asp:Parameter Name="meetingAbstract" Type="String" />
        <asp:Parameter Name="specialRequestFirst" Type="String" />
        <asp:Parameter Name="specialRequestSecond" Type="String" />
        <asp:Parameter Name="bookingState" Type="Int32" />
        <asp:Parameter Name="cancelPerson" Type="String" />
        <asp:Parameter Name="cancelTime" Type="DateTime" />
        <asp:Parameter Name="cancelReason" Type="String" />
        <asp:Parameter Name="useResult" Type="Int32" />
        <asp:Parameter Name="undefine1" Type="String" />
        <asp:Parameter Name="undefine2" Type="String" />
        <asp:Parameter Name="undefine3" Type="String" />
        <asp:Parameter Name="bookingID" Type="String" />
    </UpdateParameters>
</asp:SqlDataSource>

